<!DOCTYPE html>
<html lang="en" style="background: #F1F1F1 !important;overflow-y: scroll">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <link rel="stylesheet" href="../dist/main.css">

</head>
<body  style="background: #F1F1F1 !important;">



<div id="refreshContainer" class="mui-content mui-scroll-wrapper" style="background: #F1F1F1 !important;">
    <div class="mui-scroll">

        <!--排序导航-->
        <div id="mine" style="padding-bottom:0 !important;">


            <!--查看大牛-->
            <div id="historyChiWrap" class="clearFix" style="margin-top: 0">
                <div class="mainBox" style="padding:0 1.16rem;border-bottom: solid 0.01rem #efeff4;height: 1.07rem">
                    <ul class="clearFix" style="padding-left: 0">
                        <li class="hasBorder oChoose">正在审核</li>
                        <li class="oChoose">申请历史</li>
                    </ul>
                </div>


            </div>


        </div>
        <!--筛选-->
        <div id="chi">


            <!--数据列表-->
            <ul class="mui-table-view" id="mui-table-view">

            </ul>
            <ul class="mui-table-view" id="mui-table-view2" style="display: none">

            </ul>
            <div id="noDatas2" style="display: none" class="noDatas">
                <img src="../img/warnNoOrders(310_240).png" alt="">
                <p>暂无记录</p>
                <div class="btns" style="display: none">
                    <button class="mui-btn mui-btn-warning mui-btn-outlined" id="bidingBtn">绑定MT5账号</button>
                </div>
            </div>


        </div>
    </div>
</div>


<view></view>

</body>
</html>
<script src="../dist/main.js"></script>
<script src="../dist/layui.js"></script>

<script>
    var chiBol=true;
    var postDatas={
        limit:10,
        offset:0,
    };
    $("title").html(mt5Obj.title)
    //个人信息
    function chiList(down) {

        var icon="";

        $.ajax({
            url: mt5Obj.allUrl + "mt/user/noCheckList",
            data:postDatas,
            success: function (data) {
                if(data.error){
                    if(data.error.code==1003111133){
                        $("#noDatas").show();
                        $("#noDatas .btns").show();


                    }
                }else {
                    if(data.total==0){
                        $("#noDatas2").show();
                    }else{
                        $("#noDatas2").hide();
                    }
                }
                if (data.rows) {


                    $("#refreshContainer").show();
                    mui('#refreshContainer').pullRefresh().endPulldownToRefresh();
                    noMore(down,data);
                    for(x in data.rows){

                        if(data.rows[x].type=="0"){
                            icon="../img/heardAccount_1(120_120).png"
                        }else{
                            icon="../img/heardAccount_2(120_120).png"
                        }

                        str = ' <div class="auditWrap">'+
                            '                    <div class="mainBox">'+
                            '                        <img src="'+icon+'" alt="">'+
                            '                        <div class="rightBox">'+
                            '                            <div class="textBox">'+
                            '                                <span>姓名：</span>'+
                            '                                <span>'+data.rows[x].realName+'</span>'+
                            '                            </div>'+
                            '                            <div class="textBox">'+
                            '                                <span>MT5账号：</span>'+
                            '                                <span class="yellow">'+data.rows[x].login+'</span>'+
                            '                            </div>'+
                            '                            <div class="textBox">'+
                            '                                <span>昵称：</span>'+
                            '                                <span>'+data.rows[x].name+'</span>'+
                            '                            </div>'+
                            '                            <div class="textBox" style="margin-bottom: 0">'+
                            '                                <span>申请时间：</span>'+
                            '                                <span>'+data.rows[x].createTime+'</span>'+
                            '                            </div>'+
                            '                            <button class="canselButton canselApply" login="'+data.rows[x].login+'">取消申请</button>'+
                            '                        </div>'+
                            '                    </div>'+
                            '                </div>';

                        $("#mui-table-view").append(str)
                    }


                }



            }
        })
    }

    //    上拉刷新配置
    refreshApp();
    //下拉刷新
    function  refrecha() {
        $("#mui-table-view .auditWrap ").remove();
        $("#mui-table-view2 .auditWrap ").remove();
        postDatas.offset=0;
        self=this;
        if (chiBol){
            chiList("down")
        }else{
            historyList("down")
        }


    }

    //    上拉加载
    function loadMore() {
        var offset=postDatas.offset
        self=this
        postDatas.offset=postDatas.offset+=10;
        if (chiBol){
            chiList()
        }else{
            historyList()
        }


    }
    //    筛选
    mui("body").on('tap','.oChoose',function(){
        $("#mui-table-view .auditWrap ").remove();
        $("#mui-table-view2 .auditWrap ").remove();
        $(this).toggleClass("hasBorder")
        $(this).siblings().removeClass("hasBorder");
        if($(this).html()=="正在审核"){
            $("#mui-table-view2").hide();
            $("#mui-table-view").show()
            postDatas.offset=0;
            chiList("down")
            chiBol=true;


        }else{
            $("#mui-table-view").hide();
            $("#mui-table-view2").show();
            postDatas.offset=0;
            chiBol=false;
            historyList("down")
        }
    })

    //    历史记录
    function historyList(down) {
        var str = "";
        var icon="";
       var state=""
        $.ajax({
            url: mt5Obj.allUrl + "mt/user/checkList",
            data:postDatas,
            success: function (data) {
                if(data.error){
                    if(data.error.code==1003111133){
                        $("#noDatas").show();
                        $("#noDatas .btns").show();


                    }
                }else {
                    if(data.total==0){
                        $("#noDatas2").show();
                    }else{
                        $("#noDatas2").hide();
                    }
                }

                if (data.rows) {
                    $("#refreshContainer").show();

                    mui('#refreshContainer').pullRefresh().endPulldownToRefresh();
                    noMore(down,data);
                    for(x in data.rows){

                        if(data.rows[x].type=="0"){
                            icon="../img/heardAccount_1(120_120).png"
                        }else{
                            icon="../img/heardAccount_2(120_120).png"
                        }
                        //0正常；1审核中；2审核失败；3冻结，4其他，5取消审核

                        if(data.rows[x].state=="0"){
                            state='<span class="state green">已完成</span>'
                        }else if (data.rows[x].state=="2"){
                            state='<span class="state red">审核失败</span>'
                        }else if (data.rows[x].state=="3"){
                            state='<span class="state red">冻结</span>'
                        }else if (data.rows[x].state=="4"){
                            state='<span class="state red">其他</span>'
                        }
                        else if (data.rows[x].state=="5"){
                            state='<span class="state red">已取消</span>'
                        }



                        str = ' <div class="auditWrap">'+
                            '                    <div class="mainBox">'+
                            '                        <img src="'+icon+'" alt="">'+
                            '                        <div class="rightBox">'+
                            '                            <div class="textBox">'+
                            '                                <span>姓名：</span>'+
                            '                                <span>'+data.rows[x].realName+'</span>'+
                            '                            </div>'+
                            '                            <div class="textBox">'+
                            '                                <span>MT5账号：</span>'+
                            '                                <span class="yellow">'+data.rows[x].login+'</span>'+
                            '                            </div>'+
                            '                            <div class="textBox">'+
                            '                                <span>昵称：</span>'+
                            '                                <span>'+data.rows[x].name+'</span>'+
                            '                            </div>'+
                            '                            <div class="textBox">'+
                            '                                <span>申请时间：</span>'+
                            '                                <span>'+data.rows[x].createTime+'</span>'+
                            '                            </div>'+
                            '                            <div class="textBox" style="margin-bottom: 0">'+
                            '                                <span>审核时间：</span>'+
                            '                                <span>'+data.rows[x].examineTime+'</span>'+
                            '                            </div>'+
                            '                        </div>'+
                            state+
                            '                    </div>'+
                            '                </div>';

                        $("#mui-table-view2").append(str)
                    }


                }



            }
        })
    }
//删除申请
    mui("body").on('tap','.canselApply',function(){
      var login =$(this).attr("login");
      $.ajax({
          url: mt5Obj.allUrl + "mt/user/cancelCheck",
          type:"post",
          data:{
              login:login
          },
          success:function (data) {
              if (data.data){
                  $("#mui-table-view .auditWrap ").remove();
                  chiList("down");
              }else{
                  mui.alert("取消失败！")
              }
          }
      })
    })

</script>




